import request from '@/utils/request';
import IS_MOCK, { BASE_URL } from '@/utils/url';

//获取设备列表
export async function getAlarmList(params) {
  const { formData } = params;
  return IS_MOCK
    ? request(`/api/warningData/getWarningChart`, {
        method: 'post',
        data: {
          ...params.formData,
        },
      })
    : request(`${BASE_URL}/alarmlevel/GetAlarmData`, {
        method: 'get',
        data: {
          ...formData,
        },
      });
}

export async function addNewAlarm(params) {
  return IS_MOCK
    ? request('/api/monitor/insert', {
        method: 'post',
        data: params,
      })
    : request(`${BASE_URL}/alarmlevel/insert`, {
        method: 'post',
        data: params,
      });
}

export async function updateAlarm(params) {
  return IS_MOCK
    ? request('/api/monitor/update', {
        method: 'post',
        data: params,
      })
    : request(`${BASE_URL}/alarmlevel/update`, {
        method: 'post',
        data: params,
      });
}
